package internal

import (
	"math/rand"
	"time"
)

type Account struct {
	PlayerID  int32 `gorm:"primary_key"`
	AccountID string `gorm:"not null;unique"`
	Password string
}

func  getAccountByAccountID(accountID string) *Account{

	var account Account
	//db := mysql.MysqlDB()
	//err := db.Where("Account = ?", accountID). Limit(1).Find(&account).Error
	//if nil != err {
	//	fmt.Println(err)
	//	return nil
	//}
	//fmt.Println("password:",account.Password)
	return &account
}


func creatAccountByAccountIDAndPassword(accountID string, password string) *Account{
	var account = Account{AccountID:accountID,Password:password}

	r := rand.New(rand.NewSource(time.Now().UnixNano()))

	account.PlayerID = r.Int31n(1000000)

	return  &account
}